package software.hust.com.hust_last.util;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.ButterKnife;

public abstract class RecyclerItem<T> {

    protected Context mContext;
    protected View mView;
    protected T mData;

    public RecyclerItem(Context context, ViewGroup parent) {
        this.mContext = context;
        mView = LayoutInflater.from(context).inflate(getLayout(), parent, false);
        ButterKnife.bind(this, mView);
    }

    public View getView() {
        return mView;
    }

    public void bindData(int position, T data) {
        this.mData = data;
        bindDataImpl(position, data);
    }

    protected abstract int getLayout();

    protected abstract void bindDataImpl(int position, T data);
}
